package com.jike.buyi.system.menu.controller;

import com.jike.buyi.system.menu.domain.MenuVo;
import com.jike.buyi.system.menu.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Slf4j
@Controller
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @ResponseBody
    @RequestMapping("/data")
    public List<MenuVo> data(){
        List<MenuVo> l = menuService.queryByUser(null);
        return l;
    }

    @RequestMapping("/toTreeGrid")
    public String toTreeGrid(){
        return "/system/menu/list";
    }

    @ResponseBody
    @RequestMapping("/doTreeGrid")
    public List<MenuVo> doTreeGrid(){
        List<MenuVo> l = menuService.queryByUser(null);
        return l;
    }

    @RequestMapping("/toinsert")
    public String toinsert(){
        return "/system/menu/insert";
    }

}
